1
2
3
4 package joeq.ClassLib.Common.java.lang;
5
6 import joeq.Allocator.HeapAllocator;
7 import joeq.Class.jq_Reference;
8 import joeq.Runtime.Monitor;
9 import joeq.Runtime.Reflection;
10 import joeq.Runtime.Unsafe;
11 import joeq.Scheduler.jq_Thread;
12
13 /***
14 * Object
15 *
16 * @author John Whaley <jwhaley@alum.mit.edu>
17 * @version $Id: Object.java 1456 2004-03-09 22:01:46Z jwhaley $
18 */
19 public abstract class Object {
20
21
22 private static void registerNatives() {}
23 public final java.lang.Class _getClass() {
24 return Reflection.getJDKType(jq_Reference.getTypeOf(this));
25 }
26 public int hashCode() { return java.lang.System.identityHashCode(this); }
27 protected java.lang.Object clone() throws CloneNotSupportedException {
28 if (this instanceof Cloneable) {
29 return HeapAllocator.clone(this);
30 } else throw new CloneNotSupportedException(this.getClass().getName());
31 }
32 public final void _notify() {
33
34 }
35 public final void _notifyAll() {
36
37 }
38 public final void _wait(long timeout) throws java.lang.InterruptedException {
39 if (timeout < 0L)
40 throw new java.lang.IllegalArgumentException(timeout+" < 0");
41
42 int count = Monitor.getLockEntryCount(this);
43 int k = count;
44 for (;;) {
45 Monitor.monitorexit(this);
46 if (--k == 0) break;
47 }
48 jq_Thread t = Unsafe.getThreadBlock();
49 java.lang.InterruptedException rethrow;
50 try {
51 t.sleep(timeout);
52 rethrow = null;
53 } catch (java.lang.InterruptedException x) {
54 rethrow = x;
55 }
56 for (;;) {
57 Monitor.monitorenter(this);
58 if (--count == 0) break;
59 }
60 if (rethrow != null)
61 throw rethrow;
62 }
63
64 }